// components/providers/toast-provider.tsx
'use client'

import { useEffect } from 'react'
import { useToast } from '@/hooks/use-toast'
import { useToastStore } from '@/stores/toast-helper'

export function ToastProvider() {
  const { toast } = useToast()
  const toastData = useToastStore((state) => state.data)

  useEffect(() => {
    if (toastData) {
      toast(toastData)
      useToastStore.getState().hide()
    }
  }, [toastData, toast])

  return null
}
